<?php /* @var $this ProductController */ ?>
<?php if (Yii::app()->user->hasFlash('success')): ?>
    <div class="alert alert-success">  
        <a class="close" data-dismiss="alert">×</a>  
        <?php echo Yii::app()->user->getFlash('success') ?>
    </div>  
<?php endif ?>
<?php if (Yii::app()->user->hasFlash('error')): ?>
    <div class="alert alert-error">  
        <a class="close" data-dismiss="alert">×</a>  
        <?php echo Yii::app()->user->getFlash('error') ?>
    </div>  
<?php endif ?>
<?php
$form = $this->beginWidget('CActiveForm', array(
    'id'=>'category-form',
    'htmlOptions' => array('enctype' => 'multipart/form-data'),
    'enableAjaxValidation' => false,
        ));
?>
<?php /* @var $form CActiveForm */ ?>
<div class="row">
    <div class="span12">
        <fieldset>  
            <legend>Danh mục</legend>  
            <div class='clearfix'>
                <label for="address">Tên danh mục</label>
                <div class='input'>
                    <?php echo $form->textField($model, 'title', array('size' => 80, 'maxlength' => 45)); ?>

                </div>
            </div>
            <div class='clearfix'>
                <label for="address">Icon</label>
                <div class='input'>
                    <div class="fileupload fileupload-new" data-provides="fileupload">
                        <div class="input-append">
                            <div class="uneditable-input span3"><i class="icon-file fileupload-exists"></i> 
                                <span class="fileupload-preview"></span>
                            </div><span class="btn btn-file">
                                <span class="fileupload-new">Chọn một file</span>
                                <span class="fileupload-exists">Thay đổi</span>
                                <?php echo CHtml::activeFileField($model, 'icon');?>
                            </span><a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Xóa</a>
                        </div>
                    </div>
                </div>
                <?php echo $form->error($model, 'icon'); ?>
            </div>
            <div class='clearfix'>
                <div class='input'>
                    <?php echo CHtml::submitButton($model->isNewRecord ? 'Nhập danh mục mới' : 'Lưu lại thay đổi', array('class' => 'btn btn-primary')); ?>
                    <?php echo CHtml::button('Quay về trang danh mục', array('class' => 'btn', 'onclick' => 'javascript:location.href = \'' . $this->createUrl('list') . '\'')) ?>
                </div>
            </div>
        </fieldset> 
    </div>
</div>
<?php $this->endWidget(); ?>